<style lang="less" scoped src="./role.less"></style>
<script src="./role.js"></script>

<template>
    <div>
        <Row>
            <span @click="showAdd"><Button type="primary" icon="android-add">新增</Button></span>
        </Row>
        <div class="main-table">
            <Table border :columns="columns" :data="data"></Table>
        </div>
        <div class="pagination">
            <Page :total="total" size="small" :page-size="pageSize" :current.sync="pageIndex" @on-change="loadList"
                  show-total show-elevator></Page>
        </div>
        <Modal
                v-model="viewModalVisible"
                title="权限设置"
                @on-ok="viewModalVisible = false"
                @on-cancel="viewModalVisible = false"
                width="40%"
                :mask-closable="false">
            <Form :model="formData" :label-width="75">
                <FormItem label="角色名称">
                    <Input v-model="formData.name" clearable></Input>
                </FormItem>
                <FormItem label="状态">
                    <Select v-model="formData.status" filterable clearable>
                        <Option :value=1>正在使用</Option>
                        <Option :value=2>停止使用</Option>
                    </Select>
                </FormItem>
                <FormItem label="描述">
                    <Input v-model="formData.description" type="textarea" :rows="4" placeholder="Enter something..."></Input>
                </FormItem>
                <FormItem label="排序">
                    <Input v-model="formData.sequence" clearable></Input>
                </FormItem>
                <FormItem label="模块设置">
                    <Tree :data="menuList" ref="menuList" show-checkbox></Tree>
                </FormItem>
            </Form>
			<div slot="footer">
				<Button type="primary" @click="save">保存</Button>
				<Button type="ghost" style="margin-left: 8px" @click="viewModalVisible = false">取消</Button>
			</div>
        </Modal>
    </div>
</template>
